package com.minglead.crawler.controller;

import com.minglead.crawler.base.ActionResult;
import com.minglead.crawler.service.YqModelAnalysisService;
import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/yq/yqModelAnalysis")
public class YqModelAnalysisController {

    @Autowired
    private YqModelAnalysisService yqModelAnalysisService;

    @Operation(summary = "行业分析")
    @GetMapping("/getDomain")
    public ActionResult getDomain(@RequestParam String input, @RequestParam Boolean isSingle) {
        return ActionResult.success("成功", yqModelAnalysisService.getDomain(input, isSingle));
    }

    @Operation(summary = "行业分析")
    @GetMapping("/getDomainByPath")
    public ActionResult getDomainByPath(@RequestParam String input) {
        return ActionResult.success("成功", yqModelAnalysisService.getDomain(input));
    }

    @Operation(summary = "类别分析")
    @GetMapping("/getThutct")
    public ActionResult getThutct(@RequestParam String input, @RequestParam Integer topN, @RequestParam Boolean isSingle) {
        return ActionResult.success("成功", yqModelAnalysisService.getThutct(input, topN, isSingle));
    }

    @Operation(summary = "类别分析")
    @GetMapping("/getThutctByPath")
    public ActionResult getThutctByPath(@RequestParam String input, @RequestParam Integer topN) {
        return ActionResult.success("成功", yqModelAnalysisService.getThutct(input, topN));
    }

    @Operation(summary = "情感分析")
    @GetMapping("/getSentiment")
    public ActionResult getSentiment(@RequestParam String input, @RequestParam Boolean isSingle) {
        return ActionResult.success("成功", yqModelAnalysisService.getSentiment(input, isSingle));
    }

    @Operation(summary = "情感分析")
    @GetMapping("/getSentimentByPath")
    public ActionResult getSentimentByPath(@RequestParam String input) {
        return ActionResult.success("成功", yqModelAnalysisService.getSentiment(input));
    }

    @Operation(summary = "关键词分析")
    @GetMapping("/getKeyword")
    public ActionResult getKeyword(@RequestParam String input, @RequestParam Integer topN, @RequestParam Integer minWordNum, @RequestParam Boolean isSingle) {
        return ActionResult.success("成功", yqModelAnalysisService.getKeyword(input, topN, minWordNum, isSingle));
    }

    @Operation(summary = "关键词分析")
    @GetMapping("/getKeywordByPath")
    public ActionResult getKeywordByPath(@RequestParam String input, @RequestParam Integer topN, @RequestParam Integer minWordNum) {
        return ActionResult.success("成功", yqModelAnalysisService.getKeyword(input, topN, minWordNum));
    }
}
